import requests from "@/api/request";
import TreeStore from "element-ui/packages/tree/src/model/tree-store";

//获取公告列表
export const getNoticePage=(page, size)=>{
    return requests({
        url: '/system/notice/customer/list',
        method: 'GET',
        params: {
            page, size
        },
    })
};
//获取房屋列表
export const categoryList=(page, size)=>{
    return requests({
        url: '/business/houseInfo/all',
        method: 'GET',
        params: {
            page, size
        },
    })
};
//获取单个房屋
export const getOnlyById=(id)=>{
    return requests({
        url: `/business/houseInfo/only/${id}`,
        method: 'GET',
    })
}
//出租房屋
export const leaseHouseInfo=(id)=>{
    return requests({
        url: `/business/houseInfo/lease/${id}`,
        method: 'POST',
    })
}
//随机获取4个房屋列表
export const randomFour=()=>{
    return requests({
        url: '/business/houseInfo/random',
        method: 'GET',
    })
};
//查询房屋
export const searchPage=(keyword)=>{
    return requests({
        url: `/business/houseInfo/search/${keyword}`,
        method: 'GET',
    })
}
//查询hs房屋
export const searchHouse=(keyword)=>{
    return requests({
        url: `/business/houseInfo/searchhouse/${keyword}`,
        method: 'GET',
    })
}
//查询hs房屋
export const searchDecorate=(keyword)=>{
    return requests({
        url: `/business/houseInfo/searchdecorate/${keyword}`,
        method: 'GET',
    })
}
//登录
export const getLogin=(LoginForm)=>{
    return requests({
        url: '/system/tourist/login',
        method: 'POST',
        data: LoginForm
    })
}
//注册
export const getRegister=(RegisterForm)=>{
    return requests({
        url: '/system/tourist/add',
        method: 'POST',
        data: RegisterForm
    })
}
//更新
export const editTourist = (personData, id) => {
    return requests({
        url: '/system/tourist/edit/' + id,
        method: 'POST',
        data: personData
    })
}
//订购
export const getOrders=(OrderForm)=>{
    return requests({
        url: '/business/orders/add',
        method: 'POST',
        data: OrderForm
    })
}
//更具游客id获取房屋订单
export const getAllOrder=(id)=>{
    return requests({
        url: `/business/orders/allOrder/${id}`,
        method: 'GET',
    })
}
//擅长订单
export const deleteOrder=(tourist,houseId)=>{
    return requests({
        url: `/business/orders/delete/${tourist}/${houseId}`,
        method: 'DELETE'
    })
}
//获取支付二维码
export const qrCode=(TradeForm)=>{
    return requests({
        url: '/business/trade/show',
        method: 'POST',
        data: TradeForm
    })
}
//获取pdf
export const getPDF=()=>{
    return requests({
        url: '/system/tourist/pdf',
        method: 'GET',
    })
}
//获取对应评论
export const  getCommentList=(id,page,size)=>{
    return requests({
        url: `/business/comment/list/${id}/${page}/${size}`,
        method: 'GET',
    })
}
//添加评论
export const  addComment=(commentForm)=>{
    return requests({
        url: '/business/comment/add',
        method: 'POST',
        data: commentForm
    })
}
//点赞
export const updateLikeNum=(id)=>{
    return requests({
        url: `/business/comment/likenum/${id}`,
        method: 'GET',
    })
}
//点赞
export const updateReplyNum=(id)=>{
    return requests({
        url: `/business/comment/likenum/reply/${id}`,
        method: 'GET',
    })
}
//检测支付成功
///business/trade/pay/{id}
export const payCheck=(id)=>{
    return requests({
        url: `/business/trade/pay/${id}`,
        method: 'GET',
    })
}
//支付订单存储
export const  addTrade=(tradeForm)=>{
    return requests({
        url: '/business/trade/add',
        method: 'POST',
        data: tradeForm
    })
}
//清空购物车
export const clearOrder=(tourist)=>{
    return requests({
        url: `/business/orders/clear/${tourist}`,
        method: 'DELETE'
    })
}
//查询订单
export const getTourist=(touristId)=>{
    return requests({
        url: `/business/trade/list/${touristId}`,
        method: 'GET',
    })
}
export const ossmp=(TradeForm)=>{
    return requests({
        url: '/system/oss/uploadnew',
        method: 'POST',
        data: TradeForm
    })
}
//投诉
export const complaint=(TradeForm)=>{
    return requests({
        url: '/business/complaint/add',
        method: 'POST',
        data: TradeForm
    })
}
//查询投诉记录
export const getComplaint=(id)=>{
    return requests({
        url: `/business/complaint/all/${id}`,
        method: 'GET',
    })
}

//撤销投诉记录
export const deleteComplaint=(id)=>{
    return requests({
        url: `/business/complaint/delete/${id}`,
        method: 'DELETE',
    })
}
